package module.scene.utils
{
	import com.darwin.darwinIsometric.core.IsoPosition;
	import com.darwin.darwinIsometric.core.Point3D;
	
	import flash.geom.Point;
	
	import module.scene.consts.SceneConst;

	public class SceneUtil
	{
		public function SceneUtil()
		{
		}
		
		/**
		 *	将后台传回的全局绝对坐标(基于格子))转化为游戏场景中的相对坐标(基于格子)
		 * @param absPosX
		 * @param absPosZ
		 * @return 
		 * 
		 */
		public static function absPosToRelPos(absPosX:int,absPosZ:int):IsoPosition
		{
			var relPos:IsoPosition = new IsoPosition(
				absPosX - SceneConst.CENTER_BLOCK_X * SceneConst.X_NUM,
				absPosZ - SceneConst.CENTER_BLOCK_Z * SceneConst.Z_NUM
			);
			return relPos;
		}
		
		/**
		 *	将游戏场景中的相对坐标(基于格子))转化为后台需要的全局绝对坐标(基于格子)
		 * @param absPosX
		 * @param absPosZ
		 * @return 
		 * 
		 */
		public static function relPosToAbsPos(relPosX:int,relPosZ:int):IsoPosition
		{
			var absPos:IsoPosition = new IsoPosition(
				relPosX + SceneConst.CENTER_BLOCK_X * SceneConst.X_NUM,
				relPosZ + SceneConst.CENTER_BLOCK_Z * SceneConst.Z_NUM
			);
			return absPos;
		}
		
	}
}